-
Notifications
You must be signed in to change notification settings - Fork 797
[NFC][SYCL] Cleanup device_impl
's properties caching
#18450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* Cache extensions * Pre-initialize all in the ctor instead of using `std::call_once` * Minor code cleanups For ``` bool a = true; for (int i = 0; i < 10; ++i) { SimpleTimer t; a &= d.has(sycl::aspect::fp16); } ``` this results in 600ns -> 42..50ns improvement. Caching fp16 aspect directly (and avoiding `std::find_if` over extensions vector) can bring it further down to about 35..45ns, but, IMO, it isn't worth extra complexity.
14e6b26
to
334f690
Compare
mutable ext::oneapi::experimental::architecture MDeviceArch{}; | ||
mutable std::once_flag MDeviceArchFlag; | ||
|
||
// TODO: Does this have a race? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a race condition here? Could you please clarify what it is exactly?
|
||
// Pre-compute some often used properties. | ||
|
||
// Is used during submission. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is about kernel submission to a queue, right? I think it would be helpful to clarify this in the comment.
Alternative approach: #18476 |
I think this is better than a simpler #18450 as it allows much easier experiments/tuning on what should be cached and how.
std::find_if
over extensions vector) can bring it further down to about 35..45ns, but, IMO, it isn't worth extra complexity.std::call_once
device_impl::has_extension
to acceptstd::string_view